export default {
  namespaced: true,
  state: {
    // 内容侧边栏显示转态
    contentSidebarState: false,
    // 我的侧边栏显示转态
    mineSidebarState: false,

    // larger-screen >= 1280px   small-screen < 1280px  
    screenSize: '',
  },
  getters: {
    contentSidebarState: state => state.contentSidebarState,
    mineSidebarState: state => state.mineSidebarState,
    screenSize: state => state.screenSize
  },
  mutations: {
    showContentSidebar(state) {
      state.contentSidebarState = true
    },
    hideContentSidebar(state) {
      state.contentSidebarState = false
    },
    showMineSidebar(state) {
      state.mineSidebarState = true
    },
    hideMineSidebar(state) {
      state.mineSidebarState = false
    },
    setScreenSize(state, size) {
      if (size >= 1280 && (state.screenSize === 'small-screen' || state.screenSize === '')) {
        state.screenSize = 'large-screen'
        state.contentSidebarState = false
      }
      if (size < 1280 && (state.screenSize === 'large-screen' || state.screenSize === '')) {
        state.screenSize = 'small-screen'
      }
    }
  },
  actions: {
    showContentSidebar({ commit }) {
      commit('hideMineSidebar')
      commit('showContentSidebar')
    },
    hideContentSidebar({ commit }) {
      commit('hideContentSidebar')
    },
    showMineSidebar({ commit }) {
      commit('hideContentSidebar')
      commit('showMineSidebar')
    },
    hideMineSidebar({ commit }) {
      commit('hideMineSidebar')
    }
  }
}
